package com.zh.web.base;

import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.zh.web.enums.Deletion;
import com.zh.web.enums.Status;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;

@Data
@ApiModel("基础模型")
@JsonInclude(JsonInclude.Include.NON_NULL)
public class BaseModel implements Serializable {
    private static final long serialVersionUID = 1L;
    @ApiModelProperty("扩展内容")
    private String extendContent;
    @ApiModelProperty("创建时间")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;
    @ApiModelProperty("创建操作人")
    private Long createOperator;
    @ApiModelProperty("更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
    @ApiModelProperty("更新操作人")
    private Long updateOperator;
    @ApiModelProperty("状态")
    @TableField(fill = FieldFill.INSERT)
    @JSONField(serialzeFeatures = SerializerFeature.WriteEnumUsingToString)
    private Status status;
    @TableLogic
    @ApiModelProperty("删除标志0否1是")
    @TableField(fill = FieldFill.INSERT)
    @JSONField(serialzeFeatures = SerializerFeature.WriteEnumUsingToString)
    @JsonIgnore
    private Deletion deleted;
}
